<template>
	<view class="page">
		<uni-nav-bar statusBar=true color="#000" fixed="true" left-icon="back" title="购买汇天富双利券A">
		</uni-nav-bar>
		<view class="head">
			<view class="amount">买入金额</view>
			<input type="text" placeholder-style="color:#a8a8a8" value="" placeholder="100元起购" class="input" />
			<view class="prompt"><text style="color: #ff9168;">03月15日</text>确认份额,开始计算收益</view>
		</view>
		<view class="main">
			<text>——————只需三步即可赚取收益——————</text>
			<view class="step">
				<view class="item">
					<image src="/static/fund/buy1.png" mode="" class="item-image"></image>
					<text>风险测评</text>
				</view>
				<view class="item">
					<image src="/static/fund/buy2.png" mode="" class="item-image"></image>
					<text>绑定银行卡</text>
				</view>
				<view class="item">
					<image src="/static/fund/buy3.png" mode="" class="item-image"></image>
					<text>上传身份证</text>
				</view>
			</view>

		</view>
		<view class="agreement">
			<switch type="checkbox" class="checkbox" @change="changState" :checked="checked"></switch>
			<view class="">
				<text> 基金销售服务由宇宁基金提供，本人已阅读并同意该产品的基金合同，招募说明书，产品规则，信息披露材料及相关协议，充分了解产品的风险特性，并自愿承担相关投资风险。</text>
			</view>
		</view>
		<view class="go-buy" @tap="open">
			立即购买
		</view>
		<uni-popup ref="popups" type="bottom" class="popup">
			<uni-popup-message type="info" message="成功消息" :duration="2000" >
				<view class="popup-message">
					<view class="title">风险测评</view>
					<view class="text">
						<text>更具相关规定我们需要先对你做一个简短的测评来验证你是否能承担投资风险</text>
					</view>
					<button type="default" size="mini" class="btn" @click="ceping">开始测评</button>
				</view>
			</uni-popup-message>
		</uni-popup>
		<uni-popup ref="popup" type="bottom" class="popup">
			<uni-popup-message type="info" message="成功消息" :duration="2000">
				<view class="risk-message">
					<view class="wraper">
						<view class="level"><text>本产品风险等级</text>
							<view style="display: flex;">
								<view class="bblue"></view>
								<view class="bblue"></view>
								<view class="bblue"></view>
								<view class="noBlue"></view>
								<view class="noBlue"></view>
							</view>
						</view>
						<view class="level">
							<text>您的投资风格</text>
							<view style="display: flex;">
								<view class="bblue"></view>
								<view class="bblue"></view>
								<view class="noBlue"></view>
								<view class="noBlue"></view>
								<view class="noBlue"></view>
							</view>
						</view>
						<view class="content">
							<view class="title">《风险提示函》</view>
							<text>依据销售适当性的相关法律法规规定，宏点基金根据投资者分类、产品风险等级或服务分级和适当性匹配结果提供如下适当性匹配意见:</text>
						</view>
						<view class="text">
							<text>您购买的基金产品<text class="title">[超出]</text>您本人的风险承受能力，请您阅读并确认本<text
									class="title">《风险提示函》</text>，并且再次考量您的投资决定。如您仍坚持购买，请点击"确认购买”，点击行为代表您已知悉该基金产品超出您本人的风险承受能力，并且自愿承担可能产生的一切不利后果和损失;同时代表您认可宏点基金及工作人员在销售过程中未主动推介该产品或服务。</text>
						</view>
					</view>
					<button type="default" class="btn" size="mini" @tap="toPayment">确认购买</button>
				</view>

			</uni-popup-message>
		</uni-popup>
	</view>
</template>

<script>
	import uniPopupMessage from "@/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue"
	export default {
		components: {
			uniPopupMessage
		},
		data() {
			return {
				checked: true,
				openPopup1:true,
				openPopup2:false,
			}
		},
		onLoad(options) {
			if(options.openPopup){
				this.$refs.popup.open()
				this.$refs.popup.closeMask()
			}
		},
		methods: {
			changState(e) {
				console.log('switch1 发生 change 事件，携带值为', e.target.value)
			},
			open() {
				// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ，type 属性将失效 ，仅支持 ['top','left','bottom','right','center']
				console.log(this.$refs.popup);
				this.$refs.popups.open()
				this.$refs.popups.closeMask()
			},
			ceping() {
				uni.navigateTo({
					url: "/pages/test/test"
				})
			},
			toPayment(){
				uni.navigateTo({
					url: "/pages/payment/payment"
				})
			}
		}
	}
</script>

<style lang="scss">
	.page {
		position: relative;
		height: 100vh;
	}

	.head {
		box-sizing: border-box;
		padding: 24rpx;
		background-color: white;
		color: #a8a8a8;

		.amount {
			margin-top: 40rpx;
		}

		.input {
			height: 150rpx;
			font-size: 50rpx;
		}

		.prompt {
			box-sizing: border-box;
			padding-left: 20rpx;
			height: 70rpx;
			line-height: 70rpx;
			background-color: #fff1ec;
		}
	}

	.main {
		text-align: center;
		font-size: 25rpx;
		color: #a8a8a8;
		padding-top: 40rpx;

		.step {
			display: flex;
			margin-top: 60rpx;
			justify-content: space-around;

			.item {
				display: flex;
				flex-direction: column;
				align-items: center;
				width: 120rpx;
				height: 100rpx;

				.item-image {
					width: 60rpx;
					height: 50rpx;
					margin-bottom: 20rpx;
				}
			}
		}

	}

	.agreement {
		padding: 24rpx;
		font-size: 24rpx;
		color: #666;
		display: flex;
		position: absolute;
		bottom: 160rpx;

		.checkbox {

			margin-left: 20rpx;
		}
	}

	.go-buy {
		height: 100rpx;
		width: 100%;
		line-height: 100rpx;
		font-size: 30rpx;
		background-color: #3476f1;
		color: white;
		text-align: center;
		position: absolute;
		bottom: 0;
	}

	.popup-message {
		height: 440rpx;
		width: 700rpx;
		margin: 0 auto;
		border-radius: 10rpx;
		text-align: center;
		background-color: white;
		overflow: hidden;
		padding: 0 24rpx;

		.title {
			font-size: 30rpx;
			margin: 40rpx 0;

		}

		.text {
			margin-top: 40rpx;
			margin-bottom: 100rpx;
			text-align: left;
			color: #999;
		}

		.btn {
			background-color: #3476f1;
			color: white;
			font-size: 30rpx;
			width: 400rpx;
			height: 90rpx;
			line-height: 90rpx;

		}
	}

	.risk-message {
		width: 710rpx;
		height: 770rpx;
		color: #999;
		border-radius: 10rpx;
		background-color: white;
		margin: 0 auto;
		box-sizing: border-box;
		position: relative;

		.wraper {
			padding: 0 20rpx;
			padding-top: 20rpx;
		}

		.content {
			margin-top: 60rpx;
		}

		.title {
			color: #6a6a6a;
			font-size: 30rpx;
			text-align: center;
		}

		.btn {
			width: 100%;
			height: 86rpx;
			line-height: 86rpx;
			background-color: #3476f1;
			color: white;
			font-size: 30rpx;
			padding: 0;
			margin: 0;
			position: absolute;
			bottom: 0;

		}

		.level {
			margin-top: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			height: 40rpx;

			.bblue {
				width: 60rpx;
				margin-right: 4rpx;
				height: 5rpx;
				background-color: #007AFF;
			}

			.noBlue {

				width: 60rpx;
				margin-right: 4rpx;
				height: 5rpx;
				background-color: #cccccc;
			}
		}
	}
</style>
